package com.qianguo.buyer.entity;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.EnumMap;

/**
 * @author eva
 * @date 16/8/17
 */
public class BuyerAddress {

    public enum AddressType {
        HOUSE(1, "家"), COMPANY(2, "公司"), SCHOOL(3, "学校"), OTHER(9, "其他"), NOTHING(0, "无");

        int id;
        String name;
        private AddressType(int id, String name) {
            this.id = id;
            this.name = name;
        }

        public int getId() {
            return id;
        }

        public static AddressType get(int id) {
            for (AddressType item : AddressType.values()) {
                if (id == item.getId()) {
                    return item;
                }
            }
            return NOTHING;
        }

        @Override
        public String toString() {
            return name;
        }
    }

    /** 收货地址id */
    @JSONField(name = "address_id")
    private int addressId;

    /** 收货人 */
    private String receiver;

    /** 联系电话 */
    private String mobile;

    /** 所属城市id */
    @JSONField(name = "province_id")
    private int provinceId = -1;

    /** 所属城市，如：上海 */
    private String province;

    /** poi表的id,小区id,学校id,大厦id */
    @JSONField(name = "poi_id")
    private int poiId = -1;

    /** 小区,学校,大厦名称 */
    @JSONField(name = "poi_name")
    private String poiName;

    /** 详细地址,如楼盘号 */
    private String address;

    /** 邮编 */
    private String zipcode;

    /** 地址类型：1家（住宅），2公司，3学校，9其他，0无 */
    @JSONField(name = "add_type")
    private int addType = -1;

    /** 是否默认收货地址，0否，1是 */
    @JSONField(name = "is_default")
    private int isDefault;

    /** 创建时间戳 */
    @JSONField(name = "created_at")
    private int createdAt;

    /** 更新时间戳 */
    @JSONField(name = "updated_at")
    private int updatedAt;


    public int getAddressId() {
        return addressId;
    }

    public void setAddressId(int addressId) {
        this.addressId = addressId;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public int getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(int provinceId) {
        this.provinceId = provinceId;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public int getPoiId() {
        return poiId;
    }

    public void setPoiId(int poiId) {
        this.poiId = poiId;
    }

    public String getPoiName() {
        return poiName;
    }

    public void setPoiName(String poiName) {
        this.poiName = poiName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getZipcode() {
        return zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }

    public int getAddType() {
        return addType;
    }

    public void setAddType(int addType) {
        this.addType = addType;
    }

    public int getIsDefault() {
        return isDefault;
    }

    public void setIsDefault(int isDefault) {
        this.isDefault = isDefault;
    }

    public int getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(int createdAt) {
        this.createdAt = createdAt;
    }

    public int getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(int updatedAt) {
        this.updatedAt = updatedAt;
    }
}
